/*
 * Copyright (c) 2019 DawnFramework. All Rights Reserved.
 * Licensed under the MIT (LICENSE) license.
 */

package org.dawn.common.service.service;

/**
 * @author Willard Hu on 2017/4/25.
 */
public class ServicePageRequest extends ServiceRequest {
    private static final long serialVersionUID = -4706879481438766721L;

    protected int page = 1;
    protected int rows = 20;

    /**
     * mysql 分页查询 offset 的起始值
     */
    public int start4Mysql() {
        return page > 1 ? (page - 1) * rows : 0;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }
}
